#include<bits/stdc++.h>
using namespace std;
const int maxn = 11000000+7;
char s[maxn<<1];
int p[maxn<<1], ans;
int tot = 0;
void rd() {
  s[tot++]='~'; s[tot++]='#';
  int ch;
  while((ch=getchar())!=EOF
      &&ch>='a'&&ch<='z') {
    s[tot++]=ch;s[tot++]='#';
  }
  s[tot]='\0';
}
int main() {
  rd();
  int mid=0, r=0;
  for(int i=1; i<tot; ++i) {
    if(i<=r) p[i]=min(p[mid*2-i], r-i+1); // Symmetric, Boundary
    while(s[i-p[i]]==s[i+p[i]]) ++p[i];
    if(p[i]+i>r) r=p[i]+i-1, mid=i;
    if(p[i]>ans) ans=p[i];
  }
  printf("%d\n", ans-1);
}

